package org.dromara.hotel.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dromara.hotel.domain.TerHotelOrders;
import org.dromara.hotel.domain.bo.TerHotelOrdersBo;
import org.dromara.hotel.domain.vo.TerHotelOrdersVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.tearoom.api.domain.vo.RemoteHtlOrderVo;

import java.util.List;

/**
 * 酒店订单Mapper接口
 *
 * @author xch
 * @date 2025-06-11
 */
public interface TerHotelOrdersMapper extends BaseMapperPlus<TerHotelOrders, TerHotelOrdersVo> {
    /**
     * 重置订单价格和优惠券
     * @param order
     * @return
     */
    Boolean resetOrderPrice(@Param("order") RemoteHtlOrderVo order);


    @Select("select  o.*,r.room_imgurl,r.hotel_name,r.room_type,h.longitude,h.latitude from ter_hotel_orders o join ter_hotel_rooms r on  o.room_id = r.id join ter_hotels h on o.hotel_id = h.id where o.order_status=#{status} and o.user_id =#{userId} ORDER BY o.create_time desc LIMIT #{pageSize}  OFFSET #{current}")
    List<TerHotelOrdersVo> selectWechatOrderPage(@Param("status") Integer status,@Param("userId") Long userId, @Param("pageSize") Integer pageSize, @Param("current") Integer current);
    @Select("select  o.*,r.room_imgurl,r.hotel_name,r.room_type,h.longitude,h.latitude from ter_hotel_orders o join ter_hotel_rooms r on  o.room_id = r.id join ter_hotels h on o.hotel_id = h.id where  o.user_id =#{userId} ORDER BY o.create_time desc LIMIT #{pageSize}  OFFSET #{current}")
    List<TerHotelOrdersVo> selectWechatOrderAllPage(@Param("userId") Long userId , @Param("pageSize") Integer pageSize, @Param("current") Integer current);

}
